var myChart1 = echarts.init(document.getElementById('mainstyles'));
option = {
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}<br/> {c} ({d}%)'
    },
    legend: {
    	bottom: '0',
        data: ['月采购', '零星采购']
    },
    series: [
        {
        	name: '采购方式',
            type: 'pie',
            radius: [0, '20%'],
     
            labelLine: {
                show: false
            },
            data: [
                {value: 1548, name: ''},
                {value: 775, name: ''}
            ],
            itemStyle:{
            	normal:{
            		color:function(params) {
                                    //自定义颜色
                                    var colorList = [          
                                            '#5470c6', '#91cc75', '#fac858', '#ee6666',
                                        ];
                                        return colorList[params.dataIndex]
                                     }
            	}
            }
        },
        {
            name: '',
            type: 'pie',
            radius: ['35%', '50%'],
            labelLine: {
                length: 20,
            },
            label: {
                formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}{d}%}  ',
                rich: {
                    a: {
                        color: '#6E7079',
                        lineHeight: 22,
                        align: 'center'
                    },
                    b: {
                        color: '#4C5058',
                        fontSize: 14,
                        fontWeight: 'bold',
                        lineHeight: 33
                    },
                    per: {
                        color: '#fff',
                        backgroundColor: '#4C5058',
                        padding: [3, 4],
                        borderRadius: 4
                    }
                }
            },
            data: [
                {value: 1548, name: '月采购'},
                {value: 775, name: '零星采购'}
            ]
        }
    ]
};

myChart1.setOption(option);


var myChart2 = echarts.init(document.getElementById('mainNum'));
option = {
    tooltip: {
        trigger: 'item'
    },
    legend: {
        bottom: '0',
        left: 'center'
    },
    series: [
        {
            name: '',
            type: 'pie',
            radius: ['30%', '50%'],
            avoidLabelOverlap: false,
            itemStyle: {
                borderRadius: 4,
                borderColor: '#fff',
                borderWidth: 2
            },
            labelLine: {
                length: 30,
            },
            label: {
                formatter: '{per|{d}%}  ',
            
                rich: {
                  
                    per: {
                        color: '#333',
                        padding: [3, 4],
                        borderRadius: 4
                    }
                }
            },
            data: [
                {value: 1048, name: '综合办公室'},
                {value: 735, name: '经营计划部'},
                {value: 580, name: '人力资源部'},
                {value: 484, name: '财务管理部'},
                {value: 300, name: '安全监察部'}
            ]
        }
    ]
};
myChart2.setOption(option);

var myChart3 = echarts.init(document.getElementById('maindetail'));
option = {
  
    tooltip: {
        trigger: 'axis'
    },
    legend: {
    	top:'5%',
        data: ['累计领用', '累计采购']
    },
    grid: {
    	top:'20%',
        left: '3%',
        right: '4%',
        bottom: '8%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['1月', '2月', '3月', '4月', '5月', '6月']
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name: '累计领用',
            type: 'line',
            smooth: true,
            color:'#fe0002',
            data: [120, 536, 425, 134, 356, 230]
        },
        {
            name: '累计采购',
            type: 'line',
            smooth: true,
             areaStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgba(58,77,233,0.8)'
                }, {
                    offset: 1,
                    color: 'rgba(58,77,233,0.3)'
                }])
            },
            data: [220, 0, 191, 234, 290, 330]
        }
    ]
};
myChart3.setOption(option);

var myChart4 = echarts.init(document.getElementById('mainwuzi'));
option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: [
        {
            type: 'category',
            data: ['拖把', '纸张', '洗手液', '垃圾桶', '复印纸', '本子', '笔', '打印机', '杯子', '毛巾', '盒子', '电脑'],
            axisTick: {
                alignWithLabel: true
            }
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            name: '',
            type: 'bar',
            barWidth: '20%',
            data: [10, 52, 200, 334, 390, 330, 220,400,50,168,354,19],
             itemStyle: {
                color: '#ffa200'
            }
        }
    ]
};
myChart4.setOption(option);